package job

import "github.com/wagslane/go-rabbitmq"

var mqUrl = "amqp://guest:guest@localhost"

// NewRabbitMQConn 创建rabbitmq连接
func NewRabbitMQConn(url string, opts ...func(*rabbitmq.ConnectionOptions)) (*rabbitmq.Conn, error) {
	return rabbitmq.NewConn(url, opts...)
}

// NewRabbitMQPublisher 创建rabbitmq发布者
func NewRabbitMQPublisher(conn *rabbitmq.Conn, opts ...func(*rabbitmq.PublisherOptions)) (*rabbitmq.Publisher, error) {
	return rabbitmq.NewPublisher(conn, opts...)
}

// NewRabbitMQConsumer 创建并返回一个RabbitMQ消费者
func NewRabbitMQConsumer(conn *rabbitmq.Conn, queueName string, opts ...func(*rabbitmq.ConsumerOptions)) (*rabbitmq.Consumer, error) {
	return rabbitmq.NewConsumer(conn, queueName, opts...)
}
